package com.guimin.agent.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.guimin.agent.entity.GuiminAgent;
import com.guimin.agent.dao.GuiminAgentDao;
import com.guimin.agent.service.GuiminAgentService;
import com.guimin.common.util.exception.BaseException;
import com.guimin.fuwu.dao.GuiminServiceDao;
import com.guimin.fuwu.entity.GuiminService;
import org.springframework.stereotype.Service;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageImpl;
import org.springframework.data.domain.PageRequest;

import javax.annotation.Resource;

/**
 * (GuiminAgent)表服务实现类
 *
 * @author makejava
 * @since 2021-11-17 10:11:10
 */
@Service
public class GuiminAgentServiceImpl extends ServiceImpl<GuiminAgentDao, GuiminAgent> implements GuiminAgentService {
    @Resource
    private GuiminAgentDao guiminAgentDao;

    @Override
    public boolean updateAgent(GuiminAgent dto) {
        if(dto == null){
            throw new BaseException("请求数据为空");
        }
        QueryWrapper<GuiminAgent> wrapper = new QueryWrapper<>();
        wrapper.eq("agent_id",dto.getAgentId());
        int update = guiminAgentDao.update(dto, wrapper);
        if(update > 0 ){
            return true;
        }else {
            return false;
        }
    }
}
